import * as $http from '@/utlis/interface/Wode'
import { reactive } from 'vue'

interface User {
  orderTime: number | string
  balance: number | string
  remark: number | string
  riderCapitalDetails: number | string
  totalAmount: number | string
  yesterdayIncome: number | string
}

export default (proxy: any) => {
  const myCount = reactive<User>({
    orderTime: '',
    balance: '',
    remark: '',
    riderCapitalDetails: '',
    totalAmount: '',
    yesterdayIncome: '',
  })
  const userCountMy = () => {
    $http.userCountMy(proxy).then((res: any) => {
      myCount.orderTime = res.data.time
      myCount.balance = res.data.balance
      uni.setStorageSync('balance', res.data.balance)
      myCount.remark = res.data.remark
      myCount.riderCapitalDetails = res.data.riderCapitalDetails
      myCount.totalAmount = res.data.totalAmount
      myCount.yesterdayIncome = res.data.yesterdayIncome
    })
  }

  return {
    userCountMy,
    myCount,
  }
}
